﻿namespace Yaaf.WP7.NativeAccess.Registry.Internals.HTC.COM_NativeAccess
{
    using Microsoft.Phone.InteropServices;

    using System;

    using Yaaf.WP7.NativeAccess.ComWrapper.HTC.COM_NativeAccess;
    using Yaaf.WP7.NativeAccess.Helper;

    internal static class Registry
    {
        internal static INativeRegistry nativeRegistry;
        public static readonly RegistryKey ClassesRoot = RegistryKey.GetKey(RegistryKey.ClassesRoot);
        public static readonly RegistryKey CurrentUser = RegistryKey.GetKey(RegistryKey.CurrentUser);
        public static readonly RegistryKey LocalMachine = RegistryKey.GetKey(RegistryKey.LocalMachine);
        public static readonly RegistryKey Users = RegistryKey.GetKey(RegistryKey.Users);

        static Registry()
        {
            Devices.Initialize();
            if (ComBridge.RegisterComDll("COM_NativeAccess.dll", new Guid("3F7F0617-94FE-4803-AE8C-2CF2DC19C6BC")) != 0)
            {
                throw new RegisterComException("Register COM Dll Fail.");
            }
            nativeRegistry = new NativeRegistry() as INativeRegistry;
        }
    }
}

